<html xmlns:th="http://www.thymeleaf.org">
<head>
    <!--资源获取-->
    <base th:href="|${#request.getContextPath()}/|">
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <!--[if lt IE 9]>
    <script type="text/javascript" src="static/lib/html5shiv.js"></script>
    <script type="text/javascript" src="static/lib/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="static/h-ui/css/H-ui.min.css"/>
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/H-ui.admin.css"/>
    <link rel="stylesheet" type="text/css" href="static/lib/Hui-iconfont/1.0.8/iconfont.css"/>
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/skin/default/skin.css" id="skin"/>
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/style.css"/>
    <!--[if IE 6]>
    <script type="text/javascript" src="static/lib/DD_belatedPNG_0.0.8a-min.js"></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <!--layui-->
    <link rel="stylesheet" type="text/css" href="static/layui/css/layui.css"/>
    <script type="text/javascript" src="static/layui/layui.js"></script>
    <title>资讯列表</title>
</head>
<body>
<nav class="breadcrumb">
    <i class="Hui-iconfont">&#xe67f;</i>
    首页
    <span class="c-gray en">&gt;</span>
    记账本
    <span class="c-gray en">&gt;</span>
    我的记账本
    <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px"
       href="javascript:location.replace(location.href);" title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a>
    <!--收藏-->
    <a id="djsc" class="btn btn-success radius r " style="line-height:1.6em;margin-top:3px" href="javascript:;"
       title="收藏">
        <i id="sc" class="layui-icon"></i>
    </a>
    <!--收藏-->
</nav>
<div class="layui-row layui-col-space30" style=" padding: 30px;">
    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 10px;">
        <legend>生活，柴米油盐</legend>
    </fieldset>
    <div class="layui-col-xs6 layui-col-sm7 layui-col-md8">
        <ul class="layui-timeline">
            <li id="jzbxx" class="layui-timeline-item">
                <i id="acc__" class="tjjzxx layui-icon layui-timeline-axis layui-icon-add-circle"></i>
                <div id="jzxq" class="layui-timeline-content layui-text">

                </div>
            </li>
            <li class="layui-timeline-item">
                <i class="layui-icon layui-timeline-axis">&#xe63f;</i>
            </li>
        </ul>
    </div>
    <div class="layui-col-xs6 layui-col-sm5 layui-col-md4">
        <div class="layui-form">
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">选择时间</label>
                    <div class="layui-input-inline">
                        <input type="text" class="layui-input" id="test1" placeholder="yyyy-MM-dd">
                    </div>
                </div>
                <button type="button" id="qdsj" class="layui-btn layui-btn-normal">确定</button>
            </div>
        </div>
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
            <legend>我的分类</legend>
        </fieldset>
        <div id="rmbq" class="layui-btn-container">

        </div>
        <button id="tjfl" type="button" class="layui-btn layui-btn-fluid layui-btn-normal">
            <i class="layui-icon  layui-icon-add-circle"></i>添加分类
        </button>
    </div>
</div>
<script type="text/javascript" src="static/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="static/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="static/lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript" src="static/my/js/post.js"></script>
<script type="text/javascript" src="static/my/js/util.js"></script>
<script>
    var dates;
    layui.use('laydate', function () {
        var laydate = layui.laydate;
        //常规用法
        laydate.render({
            elem: '#test1'
            , value: new Date()

        })

        selectaccs();
    })
    /*收藏按钮*/
    var ejhref = "acc/acchtml";//收藏路径
    var ejhrefname = "记账本"
    ccscym(ejhref)
    $("#djsc").on("click", function () {
        scym(ejhref, ejhrefname)
    })
    /*收藏按钮*/

    /*分类*/
    function accbqcx() {

        $.ajax({
            url: "acc/selectbq",
            type: "GET",
            async: false,
            success: function (regas) {
                var a = "";
                for (var r of regas) {
                    a = a + " <button name='classbq' type=\"button\" id='bq_" + r.classId + "' class=\"layui-btn classbq layui-btn-normal\" title='" + r.classRemark + "'>" + r.className + "</button>"
                }
                $("#rmbq").html(a);
            }
        })
    }

    accbqcx();
    $("#rmbq").on("click", ".classbq", function () {
        layer.open({
            type: 2,
            area: ['90%', '90%'],
            fixed: false, //不固定
            maxmin: true,
            content: 'acc/bjXg?classId=' + $(this).attr("id").split("_")[1],
            end: function () { //最后执行reload
                location.reload();
            }
        })
    })
    $("#tjfl").on("click", function () {
        layer.open({
            type: 2,
            area: ['90%', '90%'],
            fixed: false, //不固定
            maxmin: true,
            content: 'acc/bjXg',
            end: function () { //最后执行reload
                location.reload();
            }
        })
    });


    $("#qdsj").on("click", function () {
        selectaccs();
    })

    //  记账详情
    function selectaccs() {
        console.log($("#test1").val())
        $.ajax({
            url: "acc/selectaccs",
            type: "GET",
            async: false,
            data: {
                "accountTime": $("#test1").val()
            },
            success: function (regas) {
                var a = "<h3 class=\"layui-timeline-title\">" + $("#test1").val() + "</h3>";


                for (var r of regas) {
                    var sdf;
                    if (r.classMoney > 0) {
                        sdf = "收入"
                    } else {
                        sdf = "支出"
                    }
                    a = a + "<p tite='" + r.accountClass + "'>" + r.accountClass + sdf + ":" + r.classMoney + " <a><i id='acc_" + r.accountId + "' class=\"layui-icon tjjzxx   layui-icon-edit\"></i></a></p>";
                }
                $("#jzxq").html(a);
            }
        })
    }

    $("#jzbxx").on("click", ".tjjzxx", function () {
        layer.open({
            type: 2,
            area: ['90%', '90%'],
            fixed: false, //不固定
            maxmin: true,
            content: 'acc/tjacc?accountId=' + $(this).attr("id").split("_")[1],
            end: function () { //最后执行reload
                location.reload();
            }
        })
    })

</script>

<script type="text/javascript" src="static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="static/lib/jquery.contextmenu/jquery.contextmenu.r2.js"></script>
<script type="text/javascript" src="static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="static/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="static/lib/datatables/1.10.15/jquery.dataTables.min.js"></script>
<script type="text/javascript">


</script>

</body>
</html>
